<template>
  <div class="BomCodeSelect" >
    <el-select v-model="param.bomCode"  clearable placeholder="请选择"  v-on:change="formatInputValue" multiple :disabled="disabled">
      <el-option v-for="(item,index) in getMappingStatusArray('bom_code')"
                 :value="item.value" :label="item.label" :key="index"></el-option>
    </el-select>
<!--    <div v-bind:value="value" v-on:change="formatInputValue"></div>-->
  </div>
</template>


<script>
    import {getForm, postForm} from '@/api/gen/gen'
    import moment from "moment";
    import {
      getMappingStatusArray,
    } from "../../../../api/subwayRat/commonCheck";

    export default {
      name:'BomCodeSelect',
      model:{
        prop:'value',
        event:'change'
      },
        data() {
            return {
              param:{
                bomCode:this.value?this.value.split(','):null,
              },
              optionList: [], //下拉列表数据
              optionMap: {}, //下拉列表映射集，往往对组件的使用者很有用
              innerValue: null //v-model实现 step3.子组件中不允许直接修改prop数据
            }
        },
      props: {
        value: {
          type:String
        }, //v-model实现，step1.需要绑定value
        disabled:{
          type:Boolean,
          default:true
        }
      },
      created() {

        },
        methods: {
          getMappingStatusArray,
          formatInputValue(v){
            this.$emit("change",v.join(','));
          },
          getDefault(){
            if(this.value=='' || this.value==null || this.value==undefined){
              this.param.bomCode=null;
              return;
            }
            this.param.bomCode = this.value.split(',');
          }
        },
      watch:{
          value:{
            handler(newVal, objVal) {
              this.getDefault();
              console.log(11);
            },
          }
      },
      mounted() {
      }
    }
</script>
<style >

</style>
